const app = getApp()
Page({
 data: {
 },
 onLoad: function () {
  var self=this;
  this.mapCtx = wx.createMapContext('myMap');
 
  wx.getLocation({
   type: 'gcj02',
   success(res) {
    self.setData({
     latitude : res.latitude,
     longitude : res.longitude,
     markers: [{
      id: 1,
      latitude: res.latitude,
      longitude: res.longitude,
      iconPath: '../../static/img/ding_wei.png',
      width: 30,  
      height: 30,
      callout:{
       content:"服务:青少年英语培训\r\n姓名:陶士涵\r\n电话:18808987876",
       bgColor:"#fff",
       padding:"5px",
       borderRadius:"2px",
       borderWidth:"1px",
       borderColor:"#07c160",
      }
     },
      {
       id: 2,
       latitude: res.latitude,
       longitude: res.longitude+0.01,
       iconPath: '../../static/img/ding_wei.png',
       width: 30,  
       height: 30,
       callout: {
        content: "服务:出租龙兴园西区9号楼二单元501\r\n姓名:陶士涵\r\n电话:18808987876",
        bgColor: "#fff",
        padding: "5px",
        borderRadius: "2px",
        borderWidth: "1px",
        borderColor: "#07c160",
         
       }
      },
      {
        id: 2,
        latitude: res.latitude+0.01,
        longitude: res.longitude,
        iconPath: '../../static/img/ding_wei.png',
        width: 30,  
        height: 30,
        callout: {
         content: "服务:出租龙兴园西区9号楼二单元501\r\n姓名:陶士涵\r\n电话:18808987876",
         bgColor: "#fff",
         padding: "5px",
         borderRadius: "2px",
         borderWidth: "1px",
         borderColor: "#07c160",
          
        }
       }
     ],
    },()=>{
        let obj = {
            latitude:this.data.latitude,
            longitude:this.data.longitude
          }
          let points;
          points.push(obj)
          this.mapCtx.includePoints({
            padding:[100,100,100,100], 
            points,
         })
    });
   }
   
  })
 },
})